package cn.wxt.ssmtemplete.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

import cn.wxt.ssmtemplete.model.User;
import cn.wxt.ssmtemplete.service.UserService;

@Controller
@RequestMapping("/user")
public class UserController {
    
    @Autowired
    private UserService userService;
    
    @RequestMapping(value="/show.do",method=RequestMethod.GET)
    public ModelAndView showUser(@RequestParam("id")int id){
        User user = this.userService.selectUser(id);
        System.out.println(user);
        ModelAndView modelAndView = new ModelAndView("user");
        modelAndView.addObject("message", user);
        return modelAndView;
    }
}
